/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ejercicio.practica3;

import java.text.NumberFormat;

/**
 *
 * @author manolo
 */
public class Pentagono extends Poligono {

    private Punto[] pentagono = new Punto[5];

    public Pentagono(int lados, Punto centro, Punto vertice) {
        super(lados, centro, vertice);
        for (int i = 0; i < lados; i++) {
            pentagono[i] = super.getPunto(i);
        }
        System.out.println(this.toString());
    }

    @Override
    public String toString() {
        NumberFormat nf = NumberFormat.getInstance();
        String cadena = "Pentagono{ ";

        for (int i = 0; i < 5; i++) {
            cadena += "(" + nf.format(pentagono[i].getX()) + ", " + nf.format(pentagono[i].getY()) + ")";
        }

        return cadena += "}";
    }

}
